/*************************************************************************
	> File Name: decorator.h
	> Author: ma6174
	> Mail: ma6174@163.com 
	> Created Time: 2021年11月23日 星期二 21时04分14秒
 ************************************************************************/

#include <iostream>
#include <string>

class Person
{
public:
	Person(){}
	Person(std::string name) : name(name) {}

	void show()
	{
		std::cout << "装扮的" << name << std::endl;
	}

	std::string name;
};

class Finery : public Person
{
public:
	Finery(Person* p) : Person(p->name) {}
	virtual ~Finery() = default;
	void decorate(Person* p)
	{
		com1 = p;
	}

	void decorate(Finery* f)
	{
		com2 = f;
	}

	virtual void show()
	{
		if (com1 != nullptr)
			com1->show();
		if (com2 != nullptr)
			com2->show();
	}

protected:
	Person* com1;
	Finery* com2;
};


class TShirts : public Finery
{
public:
	using Finery::Finery;
	virtual void show()
	{
		std::cout << "大Ｔ恤 ";
		Finery::show();
	}
};

class BigTrouser : public Finery
{
public:
	using Finery::Finery;
	virtual void show()
	{
		std::cout << "裤子 ";
		Finery::show();
	}
};

class Sneakers : public Finery
{
public:
	using Finery::Finery;
	virtual void show()
	{
		std::cout << "破球鞋 ";
		Finery::show();
	}
};

class LeatherShoes : public Finery
{
public:
	using Finery::Finery;
	virtual void show()
	{
		std::cout << "皮鞋 ";
		Finery::show();
	}
};

class Tie : public Finery
{
public:
	using Finery::Finery;
	virtual void show()
	{
		std::cout << "领带 ";
		Finery::show();
	}
};

class Suit : public Finery
{
public:
	using Finery::Finery;
	virtual void show()
	{
		std::cout << "西装 ";
		Finery::show();
	}
};
